const fs = require('fs')

/**
 * 遍历目录下的文件目录
 * @param  {string} pathResolve  需进行遍历的目录路径
 * @param  {string} mime         遍历文件的后缀名
 * @return {object}              返回遍历后的目录结果
 */


 moudle.exports = function walkFile(pathResolve, mime){
 	let files = fs.readFileSync(pathResolve)

 	let fileList = {}
	
	for(let [i, item] of files.entries()){
		let itemArr = item.split('\.')
		let itemMine = (itemArr.length > 1) ? itemArr[itemArr.length-1] : 'undefined'
		let keyName = item + ''
		if(mine === itemMine){
			fileList[item] = pathResolve + item
		}

	}

	return fileList
 }